package com.kyzh.core.dialog

import android.annotation.SuppressLint
import android.app.Activity
import android.view.LayoutInflater
import android.view.View
import androidx.appcompat.app.AlertDialog
import androidx.databinding.DataBindingUtil
import com.kyzh.core.R
import com.kyzh.core.activities.TaskCenterActivity
import com.kyzh.core.databinding.DialogGetpointBinding
import com.kyzh.core.utils.startActivity


private var getpointDialog:AlertDialog?=null

fun Activity.showGetPointDialog(){
    getpointDialog = AlertDialog.Builder(this, R.style.kyzhGuestLoginDialog)
            .setView(getView())
            .create()

    getpointDialog?.show()
}
@SuppressLint("ClickableViewAccessibility")
private fun Activity.getView():View{
    val binding = DataBindingUtil.inflate<DialogGetpointBinding>(LayoutInflater.from(this),R.layout.dialog_getpoint,null,false)

    binding.btGet.setOnClickListener {
        getpointDialog?.dismiss()
        startActivity<TaskCenterActivity>()
    }
    return binding.root
}